package com.hp.controller;

import com.hp.pojo.Concern;
import com.hp.service.ConcernService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.Mapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController

public class ConcernController {

    @Autowired
    private ConcernService concernService;

    @PostMapping ("/getAllConcerns")
    public Map<String,Object> getAllConcerns(int userId){

        return concernService.getALlConcern(userId);
    }

    @PostMapping ("/isConcern")
    public Map<String,Object> isConcern(int userId, int houseId){
        return concernService.isConcern(userId, houseId);
    }


    @PostMapping ("/addConcern")
    public Map<String,Object> addConcern(int houseId, int userId, int concernType){
        return concernService.addConcern(houseId, userId, concernType);
    }


    @PostMapping ("/delConcern")
    public Map<String,String> delConcern(int userId, int houseId){
        return concernService.delConcern(userId, houseId);
    }


}
